using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WPCoco
{

    /// <summary>
    /// Struct that store trim data in a 2D space
    /// </summary>
    public struct Trim
    {
        #region Static

        public static Trim Empty { get { return new Trim(0, 0, 0, 0); } }

        #endregion

        public Trim(int left, int top, int right, int bottom)
        {
            this.left = left; this.top = top; this.right = right; this.bottom = bottom;
        }

        int top;
        /// <summary>
        /// Pixel trimed in top
        /// </summary>
        public int Top
        {
            get { return top; }
            set { top = value; }
        }

        int left;
        /// <summary>
        /// Pixels trimed in left
        /// </summary>
        public int Left
        {
            get { return left; }
            set { left = value; }
        }

        int bottom;
        /// <summary>
        /// Pixels trimed in the bottom
        /// </summary>
        public int Bottom
        {
            get { return bottom; }
            set { bottom = value; }
        }

        int right;
        /// <summary>
        /// Pixels trimed in right
        /// </summary>
        public int Right
        {
            get { return right; }
            set { right = value; }
        }

        /// <summary>
        /// Total width of trimed pixels
        /// </summary>
        public int TotalWidth 
        {
            get { return left + right; }
        }

        /// <summary>
        /// Totak height of trimed pixels
        /// </summary>
        public int TotalHeight
        {
            get { return top + bottom; }
        }

        public override string ToString()
        {
            return string.Format("Left = {0}, Top = {1}, Right = {2}, Bottom = {3}", left, top, right, bottom);
        }
    }
}
